<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/pages/stock_manage/";
%>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <base href="<%= basePath %>"/>
    <title>库存预警</title>
    <style>
        body {
            margin: 0;
            font-family: 'Segoe UI', 'Arial', sans-serif;
            background: #f5f6fa;
        }
        .header {
            background: #4f8cff;
            color: #fff;
            padding: 24px 0 18px 0;
            text-align: center;
            font-size: 2rem;
            font-weight: bold;
            letter-spacing: 2px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.04);
        }
        .container {
            max-width: 1200px;
            margin: 30px auto;
            padding: 0 20px;
        }
        .form-group {
            margin-bottom: 20px;
        }
        .form-group label {
            display: block;
            margin-bottom: 8px;
        }
        .form-group input, .form-group select {
            width: 100%;
            padding: 10px;
            border: 1px solid #dcdde1;
            border-radius: 4px;
        }
        .warning-list {
            width: 100%;
            border-collapse: collapse;
        }
        .warning-list th, .warning-list td {
            border: 1px solid #ddd;
            padding: 8px;
            text-align: left;
        }
        .warning-list th {
            background-color: #f2f2f2;
        }
    </style>
</head>
<body>
<div class="header">库存预警</div>

<div class="container">
    <!-- 预警阈值设置区域 -->
    <div class="form-group">
        <h2>预警阈值设置</h2>
        <form id="warningThresholdForm">
            <div class="form-group">
                <label for="productId">商品：</label>
                <select id="productId" name="productId">
                    <option value="">请选择商品</option>
                    <!-- 这里可以根据实际数据动态生成选项 -->
                    <option value="1">商品A</option>
                    <option value="2">商品B</option>
                </select>
            </div>
            <div class="form-group">
                <label for="minThreshold">最低库存预警阈值：</label>
                <input type="number" id="minThreshold" name="minThreshold">
            </div>
            <div class="form-group">
                <label for="maxThreshold">最高库存预警阈值：</label>
                <input type="number" id="maxThreshold" name="maxThreshold">
            </div>
            <button type="button" onclick="setWarningThreshold()">提交</button>
        </form>
    </div>

    <!-- 预警信息展示区域 -->
    <div>
        <h2>预警信息展示</h2>
        <table class="warning-list">
            <thead>
            <tr>
                <th>商品名称</th>
                <th>当前库存</th>
                <th>预警类型</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <!-- 这里可以根据实际数据动态生成表格内容 -->
            <tr>
                <td>商品A</td>
                <td>100</td>
                <td>低库存预警</td>
                <td><button onclick="handleWarning('商品A')">处理</button></td>
            </tr>
            <tr>
                <td>商品B</td>
                <td>50</td>
                <td>高库存预警</td>
                <td><button onclick="handleWarning('商品B')">处理</button></td>
            </tr>
            </tbody>
        </table>
    </div>

    <!-- 预警通知配置区域 -->
    <div>
        <h2>预警通知配置</h2>
        <form id="notificationConfigForm">
            <div class="form-group">
                <label for="notificationMethod">通知方式：</label>
                <select id="notificationMethod" name="notificationMethod">
                    <option value="email">邮件</option>
                    <option value="sms">短信</option>
                </select>
            </div>
            <div class="form-group">
                <label for="recipient">接收人：</label>
                <input type="text" id="recipient" name="recipient">
            </div>
            <button type="button" onclick="configureNotification()">保存</button>
        </form>
    </div>
</div>

<script>
    function setWarningThreshold() {
        // 这里可以添加 AJAX 请求来设置商品库存预警阈值
        alert('预警阈值设置功能暂未实现');
    }

    function handleWarning(productName) {
        // 这里可以添加 AJAX 请求来处理预警信息
        alert('处理预警功能暂未实现');
    }

    function configureNotification() {
        // 这里可以添加 AJAX 请求来配置预警通知
        alert('预警通知配置功能暂未实现');
    }
</script>
</body>
</html>
